package com.ruoyi.web.controller.schoolApp;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.schoolApp.domain.WxLoginDo;
import com.ruoyi.schoolApp.service.WxLoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ctl
 * @date 2024-01-26
 */
@RestController
@RequestMapping("/wxLoginApi")
@Slf4j
public class WxLoginController extends BaseController {
    @Resource
    private WxLoginService wxLoginService;

    @GetMapping("/openId/{code}")
    public R getOpenId(@PathVariable("code") String code) {
        String openId = wxLoginService.getOpenId(code);
        return R.ok(openId, "ok");
    }

    @GetMapping("/demo")
    public R getWechatBaseInfo() {
      return R.ok(200,"成功");
    }
}
